/*
 * @Author: tangchuan 1944302118@qq.com
 * @Date: 2024-03-27 13:40:25
 * @LastEditors: tangchuan 1944302118@qq.com
 * @LastEditTime: 2024-04-16 18:03:51
 * @FilePath: \jeecg-novel\src\views\order\monthlyOrder\UserSubOrder.data.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '订阅日期',
    align: 'center',
    dataIndex: 'subTime',
  },
  {
    title: '会员用户名',
    align: 'center',
    dataIndex: 'username',
  },
  {
    title: '会员邮箱',
    align: 'center',
    dataIndex: 'email',
  },
  {
    title: '订阅金额',
    align: 'center',
    dataIndex: 'payMoney',
  },
  {
    title: '支付状态',
    align: 'center',
    dataIndex: 'payStatus',
    customRender: ({ text }) => {
      let str = '';
      switch (text) {
        case 0:
          str = '待支付';
          break;
        case 1:
          str = '已支付';
          break;
        case 2:
          str = '取消支付';
          break;
        case 4:
          str = '取消订阅';
          break;
        default:
          str = '未知';
      }
      return str;
    },
  },
  {
    title: '支付平台',
    align: 'center',
    dataIndex: 'payType',
    customRender: ({ text }) => {
      return text == 1 ? 'paypal' : 'stripe';
    },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订阅日期/支付时间',
    field: 'subTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '用户ID',
    field: 'userId',
    component: 'InputNumber',
  },
  {
    label: '订阅金额',
    field: 'payMoney',
    component: 'InputNumber',
  },
  {
    label: '订阅/支付状态：0 待支付，1 已支付，2 取消支付 4-取消订阅',
    field: 'payStatus',
    component: 'InputNumber',
  },
  {
    label: '支付平台 1--paypal 3-stripe',
    field: 'payType',
    component: 'Input',
  },
  {
    label: '第三方订单ID',
    field: 'transactionId',
    component: 'Input',
  },
  {
    label: '支付平台创建的用户ID',
    field: 'transactionUserId',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
